<?php
if (!defined("MCTDESIGN")) die("# ");

function action_baogia(){
    global $anyDB,$tb_fix;
    $sql = "select config_values from ".$tb_fix."_config where config_name = 'shop_baogia'";
    $q = $anyDB->query($sql);
    $r = $anyDB->getNext($q);
    if($r['config_values'] != ''){
                $baogia = $r['config_values'];
                $file = $baogia;
                $extension = end(explode('.', $baogia));
                error_reporting(E_ALL);
                ini_set("display_errors",1);
                $mimeType=get_file_mime_type($baogia);            
                header('Content-Description: File Transfer');
                header('Content-Type: ' . $mimeType);
                header("Content-Disposition: attachment; filename=\"".basename($file)."\";" );
                //header('Content-Disposition: attachment; filename='.basename($file));
                header('Content-Transfer-Encoding: binary');
                header('Expires: 0');
                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                header('Pragma: public');
                header('Content-Length: ' . filesize($file));
                ob_clean();
                flush();
                readfile($baogia);
                exit;
    }else{
        echo "<script>alert('Chưa có báo giá nào!')</script>";
        header("Location: home.html");
    }    
}
function action_gioithieu(){
    global $anyDB,$tb_fix,$temp,$dir_tpl;
    $temp->assign( 'base_tpl', "".$dir_tpl."" );
    $html_about = get_data('shop_about','config_values');
    $temp->assign( 'html_about', "".$html_about."" );
    $content = $temp->fetch( '_abouts.mct' );
    return $content;
}
function action_baohanh(){
    global $anyDB,$tb_fix,$temp,$dir_tpl;
    $temp->assign( 'base_tpl', "".$dir_tpl."" );
    $html_baohanh = get_data('shop_term','config_values');
    $temp->assign( 'html_baohanh', "".$html_baohanh."" );
    $content = $temp->fetch( '_baohanh.mct' );
    return $content;
}
function action_tuyendung(){
    global $anyDB,$tb_fix,$temp,$dir_tpl;
    $temp->assign( 'base_tpl', "".$dir_tpl."" );
    $html_tuyendung = get_data('shop_jobs','config_values');
    $temp->assign( 'html_tuyendung', "".$html_tuyendung."" );
    $content = $temp->fetch( '_tuyendung.mct' );
    return $content;
}

$go = $_GET['go'];
switch($go){
    case "baogia":
        action_baogia();
        break;
    case "gioithieu":
        $content =action_gioithieu();
        break;
    case "baohanh":
        $content = action_baohanh();
        break;    
     default:
        $content = action_tuyendung();
        break;       
}
/**
 * ZaiDung | Mongcaitoday.com | hd_n2ct@yahoo.com
 * hien thi thong tin config site.
 */
?>